<template>
	<view class="page">
		<view class="account">
			<view class="title">
				账号
			</view>
			<view class="number">
				{{phone.slice(0,4)+'****'+phone.slice(-2)}}
			</view>
		</view>
		<view class="account">
			<view class="title">
				绑定手机号
			</view>
			<view class="number">
				{{phone.slice(0,4)+'****'+phone.slice(-2)}}<image style="width: 36rpx;" src="https://cdn8.axureshop.com/demo/2208121/images/%E5%8C%BB%E7%94%9F%E4%B8%BB%E9%A1%B5/u7110.svg" mode="widthFix"></image>
			</view>
		</view>
		
		<!-- 修改密码 -->
		<view class="change">
			<view class="title">
				修改密码
			</view>
			<view class="number" @click="goChage">
				去修改 <image style="width: 36rpx;" src="https://cdn8.axureshop.com/demo/2208121/images/%E5%8C%BB%E7%94%9F%E4%B8%BB%E9%A1%B5/u7110.svg" mode="widthFix"></image>
			</view>
		</view>
		
		<!-- 退出登录 -->
		<button class="logOut" @click="logout">退出登录</button>
	</view>
</template>

<script setup>
	import { onLoad } from '@dcloudio/uni-app'
	import api from '../../src/utils/api.js'
	import { ref } from 'vue'
	const phone = ref('')
	onLoad(()=>{
		api('/appselectid',{
			userid:uni.getStorageSync('userid')
		}).then(res=>{
			console.log(res)
			phone.value = res.data[0].phone
		}).catch(err=>{
			console.log(err)
		})
	})
	// 修改密码
	const goChage = () => {
		uni.navigateTo({
			url:'/pages/forget/forget'
		})
	}
	// 退出
	const logout = () => {
		uni.removeStorageSync('token')
		uni.reLaunch({
			url:'/pages/register/register'
		})
	}
</script>

<style lang="scss" scoped>
	.page {
		background-color: #f2f2f2;
		min-height: 100vh;
		.account{
			height: 100rpx;
			background-color: #fff;
			padding:  0 40rpx;
			border-bottom: 2rpx solid #f2f2f2;
			box-sizing: border-box;
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-family: 'Microsoft YaHei UI', sans-serif;
			font-size: 28rpx;
			color: #000;
			.number{
				display: flex;
				align-items: center;
			}
		}
		.change{
			height: 100rpx;
			background-color: #fff;
			padding:  0 40rpx;
			border-bottom: 2rpx solid #f2f2f2;
			box-sizing: border-box;
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-family: 'Microsoft YaHei UI', sans-serif;
			font-size: 28rpx;
			color: #000;
			margin-top: 30rpx;
			.number{
				color: #aaa;
				display: flex;
				align-items: center;
			}
		}
		// 退出登录
		.logOut{
			width: 660rpx;
			height: 80rpx;
			line-height: 80rpx;
			position: absolute;
			bottom: 40rpx;
			left: 50%;
			transform: translateX(-50%);
			background-color: rgba(255, 77, 79, 1);
			border-radius: 16rpx;
			font-family: 'ArialMT', 'Arial', sans-serif;
			font-size: 28rpx;
			color: #fff;
		}
	}       
</style>
